<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="copyright" content="www.apicloud.com" />
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>仪表盘</title>
		<link rel="stylesheet" type="text/css" href="../../css/api.css" />
		<style>
			#main {
				display: -webkit-box;
				display: -webkit-flex;
				display: flex;
				-webkit-box-orient: vertical;
				-webkit-flex-flow: column;
				flex-flow: column;
			}
			#header {
				position: relative;
				background-color: #1abc9c;
				border-bottom: 1px solid #e0e0e0;
			}
			.logo {
				position: absolute;
				left: 20px;
				bottom: 13px;
				height: 25px;
			}
			h1 {
				height: 50px;
				line-height: 50px;
				font-size: 20px;
				color: #fff;
				font-weight: normal;
				margin: 0 auto;
				text-align: center;
			}
		</style>
	</head>
	<body>
		<div id="main">
			<header id="header">
				<img class="logo" src="../../image/ic_back_u.png" tapmode onclick="api.closeWin()" />
				<!--<h1 id="title">病虫害管理 <img class="toobarimg" style="float: right;margin-right: 10px;" id="addsbbnb" onclick="tabAdd()"  src="../../image/fabu.png" tapmode />添加</h1>-->
			<h1 id="title"><span style="margin-left: 20px">病虫管理</span><span class="toobarimg" style="float: right;margin-right: 13px;font-size: 15px;" id="addsbbnb" onclick="tabAdd()" tapmode>添加</span></h1>
			</header>
		</div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/common.js"></script>
	<script type="text/javascript" src="../../script/jquery-1.11.0.min.js"></script>
	<script type="text/javascript">
		//項目id
		//		var departid = $api.getStorage('selectpor').id;
		//用户id
		//		var userid = $api.getStorage('userSession').data.id;
		////企业id
		//		var qiyeid = $api.getStorage('userSession').data.depart.id;
		var number=0;
		apiready = function() {
			$("#titles").hide();
			var $header = $api.dom('header');
			$api.fixIos7Bar($header);
			$api.fixStatusBar($header);
			var thridHeader = $api.offset(header);
			api.openFrame({
				name : 'yibiaopan_frame',
				url : 'bingchonghai_frame.html',
				rect : {
					x : 0,
					y : thridHeader.h,
					w : 'auto',
					h : 'auto'
				},
				bounces : true,
				delay : 200
			});
			
				api.addEventListener({
			name : 'bc'
		}, function(ret, err) {
		number=ret.value.key1;
		if(ret.value.key1==2){
			$("#addsbbnb").hide();
		}
		if(ret.value.key1==1){
			$("#addsbbnb").show();
		}
		if(ret.value.key1==0){
			$("#addsbbnb").show();
		}
			
		});
		};
		function add() {
			$.ajax({
				type : "post",
				//async : false, //同步执行
				url : BaseServiceUrl + "app/lnsecthistory/loadAdd.json",
				data : {
					projectid : departid
				},
				dataType : "json", //返回数据形式为json
				success : function(result) {
					//alert(JSON.stringify(result));
					api.openFrame({
						name : 'xxxxx',
						url : 'congqingjianche_window.html',
						rect : {
							x : 0,
							y : 0,
							w : 'auto',
							h : 'auto'
						},
						pageParam : {
							result : result
						}, //传递参数
						bounces : true,
						delay : 200
					});
				}
			});
		}

		function addls() {
			$.ajax({
				type : "post",
				//async : false, //同步执行
				url : BaseServiceUrl + "app/lnsecthistory/loadAddls.json",
				data : {
					projectid : departid,
					departId : userid
				},
				dataType : "json", //返回数据形式为json
				success : function(result) {
					//alert(JSON.stringify(result));
					api.openWin({
						name : 'xxxxxs',
						url : 'addls_window.html',
						rect : {
							x : 0,
							y : 0,
							w : 'auto',
							h : 'auto'
						},
						pageParam : {
							result : result
						}, //传递参数
						bounces : true,
						delay : 200
					});
				}
			});
		}

		var bbnb = document.getElementById('addsbbnb');
	
		function tabAdd() {
//			if(number==2){
//			alert("隐藏");
//				$("#addsbbnb").hide();
//			}
		
			switch(number) {
				case 0:
					bbnb.onclick = function() {
						openDetail('congqingjianche_window.html')
					};
					break;
				case 1:
					bbnb.onclick = function() {
						openDetail('addls_window.html')
					};
					break;
			}
		}
	</script>
</html>
